import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
      meta: {
        title: '首页'
      }
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/AboutView.vue'),
      meta: {
        title: '关于我们'
      }
    },
    {
      path: '/test',
      name: 'test',
      component: () => import('../views/TestView.vue'),
      meta: {
        title: '组件测试'
      }
    },
    // 赛事管理路由
    {
      path: '/matches',
      name: 'matches',
      redirect: '/matches/list',
      meta: {
        title: '赛事管理'
      }
    },
    {
      path: '/matches/list',
      name: 'matchesList',
      component: () => import('../views/Matchs/index.vue'),
      meta: {
        title: '赛事列表'
      }
    },
    {
      path: '/matches/details',
      name: 'matchesDetails',
      component: () => import('../views/Matchs/Details-Matchs/index.vue'),
      meta: {
        title: '赛事详情'
      }
    },
    {
      path: '/matches/add',
      name: 'matchesAdd',
      component: () => import('../views/Matchs/add/add.vue'),
      meta: {
        title: '新增赛事'
      }
    },
    {
      path: '/matches/statistics',
      name: 'matchesStatistics',
      component: () => import('../views/Matchs/statistics.vue'),
      meta: {
        title: '数据统计'
      }
    },
    // 选手管理路由
    {
      path: '/players',
      name: 'players',
      redirect: '/players/list',
      meta: {
        title: '选手管理'
      }
    },
    {
      path: '/players/list',
      name: 'playersList',
      component: () => import('../views/Players/index.vue'),
      meta: {
        title: '选手列表'
      }
    },
    {
      path: '/players/profile',
      name: 'playersProfile',
      component: () => import('../views/Players/profile.vue'),
      meta: {
        title: '选手档案'
      }
    },
    {
      path: '/players/ranking',
      name: 'playersRanking',
      component: () => import('../views/Players/ranking.vue'),
      meta: {
        title: '排行榜'
      }
    },
    {
      path: '/players/statistics',
      name: 'playersStatistics',
      component: () => import('../views/Players/statistics.vue'),
      meta: {
        title: '选手统计'
      }
    },
    // 系统管理路由
    {
      path: '/system',
      name: 'system',
      redirect: '/system/users',
      meta: {
        title: '系统管理'
      }
    },
    {
      path: '/system/users',
      name: 'systemUsers',
      component: () => import('../views/System/users.vue'),
      meta: {
        title: '用户管理'
      }
    },
    {
      path: '/system/settings',
      name: 'systemSettings',
      component: () => import('../views/System/settings.vue'),
      meta: {
        title: '系统设置'
      }
    }
  ],
})

export default router
